from tweetParser import *

p = parser()
p.upTweet.connect()
p.upTweet.cursor.execute("""SELECT * FROM Tweets WHERE Confidence = 1""")
result_set = p.upTweet.cursor.fetchall ()
for row in result_set:
    rowId = None
    if row == None:
        break
    t = tweetObject()
    rowId = row[0]
    t.userName = row[1]
    t.text = row[2]
    t.score = row[6]
    t.eventDate = row[7]
    #print t.text
    tweetTest = p.isGood(t)
    t = p.scoreTweet(tweetTest)
    p.upTweet.cursor.execute("""UPDATE Tweets SET Text=%s,Confidence=%s,EventDate=%s WHERE RowID = %s""",(t.text,t.score,t.eventDate,rowId))
    print t.text,t.score,t.eventDate
